package org.td.engine.combat.effect;


import org.td.engine.combat.Target;
import org.td.engine.entity.Entity;
import org.td.engine.entity.Projectile;
import org.td.engine.entity.ProjectileClass;

public class LaunchProjectileEffect implements Effect {

    private ProjectileClass projectileClass;

    public LaunchProjectileEffect(ProjectileClass projectileClass) {
        this.projectileClass = projectileClass;
    }

    @Override
    public void apply(Entity owner, Target target) {
        Projectile projectile = new Projectile(owner.getEntityEnvironment(), projectileClass, owner.getX() , owner.getY(), target);
        owner.getEntityEnvironment().addEntity(projectile);
    }
}
